<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<router-link to ="/home">家</router-link>
			<router-link to ="/dog">宠物</router-link>
			<router-link to ="/zoo">无间道</router-link>
			<router-view></router-view>
		</div>
		<template id="homeTem">
			<div>
				<h1>家</h1>
			</div>
		</template>
		<template id="dogTem">
			<div>
				<h1>狗</h1>
			</div>
		</template>
		<template id="tigerTem">
			<div>
				<h1>跟法官说啊，看他会不会给你机会</h1>
			</div>
		</template>
		<template id="lionTem">
			<div>
				<h1>给我一个机会</h1>
			</div>
		</template>
		<template id="zooTem">
			<div>
				<h1>无间道</h1>
				<router-link to ="/zoo/lion">刘德华</router-link>
				<router-link to ="/zoo/tiger">梁朝伟</router-link>
				<router-view></router-view>
			</div>
		</template>
		<script src="../js/vue.js">		
		</script>
		<script src="../js/vue-router.js">
		</script>
		<script>
			let homeCom={
				template:"#homeTem"
			}
			let dogCom={
				template:"#dogTem"
			}
			let zooCom={
				template:"#zooTem"
			}
			let tigerCom={
				template:"#tigerTem"
			}
			let lionCom={
				template:"#lionTem"
			}
			const router = new VueRouter({
				routes:[
					{path:"/",redirect:"/dog"},
					{path:"/home",component:homeCom},
					{path:"/dog",component:dogCom},
					{path:"/zoo",component:zooCom,
					children:[{path:"/zoo/tiger",component:tigerCom},
							{path:"/zoo/lion",component:lionCom}]}
				]
			})
			const app = new Vue({
				el:"#app",
				router
			})
		</script>
	</body>
</html>
